PickGenerator   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 7
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 4
dl 0
loc 7
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A generate 0 5 1
1
import Generator from './Base';
2
3
/**
4
 * Pick random item from the array.
5
 * @param {array} options list of available options
6
 * @returns {any} item
7
 * @requires int
8
 * @generator
9
 */
10
export default class PickGenerator extends Generator {
11
    generate(array) {
12
        const index = this.fatum.int(0, array.length - 1);
13
14
        return array[index];
15
    }
16
}
17